Home /

Developer Resource Kit 5 Article

Using the Advanced Message Box Component

The Advanced Message Box component, included with the Macromedia Flash UI Components Set 3, provides a message window that can be used to notify the user of an event or message. It is built on top of the Message Box component, included with the Flash UI Components Set 2 and adds a number of useful features, including the ability to have a scroll bar automatically appear in the message field if the message cannot fit in the window.

The component comes with a number of icons to display in the box, and allows you to specify additional icons.

Advanced Message Box component example

Sample files

Before you begin this tutorial, download the source file so that you can follow along in Macromedia Flash MX:

Using the Advanced Message Box component

Using the Advanced Message Box component only requires that it be inserted into the Macromedia Flash application from the components panel. The component's default state is on, and inserting it and testing the movie, will result in an Advanced Message Box window displaying the default information and settings.

You can specify a function to be called when the user presses a button on the component. The function will be passed two arguments, a reference to the component and the index of the button pressed.

closehandler = function(advMsgBox, buttonIndex)
  {
       trace("Button Pressed : " + 
  advMsgBox.getButtons()[buttonIndex]);
  }

The function can be specified through the Property inspector and the component's API.

Customizing and controlling the Advanced Message Box component

There are a number of ways to control and customize the component.

The first involves using the Property inspector to specify the initial settings for the component. A list of the available properties and a short description of each setting is provided below:

  • Title: The title to be displayed on the Advanced Message Box.
  • Message: The message to be displayed within the Advanced Message Box.
  • Icon: The icon to be displayed within the Advanced Message Box. The default options are none, fpb_warningIcon (a warning symbol icon), fpb_errorIcon (an error symbol icon), fpb_questionIcon (a question mark icon) and fpb_infoIcon (and info symbol icon).
  • Buttons: An array of strings containing the labels of desired buttons. A button will be created for each item within the array.
  • Close Handler: A reference to the function to be called when one of the buttons is clicked.
  • Button Width: Defines the width of the buttons.
  • Titlebar Height: Defines the height of the title bar.
  • ActiveState: Denotes if the Advanced Message Box is active, useable and visible when the SWF file starts.
  • UseScrollBars: Denotes if the Advanced Message Box should use scrollbars. The default is "auto" and the component will add and remove scrollbars as needed with this option. However, you can force scrollbar usage with true or false.

You can also interact with and customize the component at runtime, by using the Advanced Message Box's ActionScript API.

You can view a complete list of the API, as well as descriptions and examples, in the Macromedia Flash MX Reference Panel (select Window > Reference Panel) under the Flash UI Components Set 3 section.

Finally, the component can be customized through the use of FStyleFormat properties. The following properties are supported:

  • FStyleFormat.face
  • FStyleFormat.highlight
  • FStyleFormat.shadow
  • FStyleFormat.darkshadow
  • FStyleFormat.highlight3D
  • FStyleFormat.textAlign
  • FStyleFormat.textBold
  • FStyleFormat.textColor
  • FStyleFormat.textDisabled
  • FStyleFormat.textFont
  • FStyleFormat.textIndent
  • FStyleFormat.textItalic
  • FStyleFormat.textLeftMargin
  • FStyleFormat.textRightMargin
  • FStyleFormat.textSize
  • FStyleFormat.textUnderline